package com.gzdh.tang.ali.mapper;

import com.gzdh.tang.ali.dto.AliOrderDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface AliPubMapper {

    @Select("select count(*) as counts,isNull(sum(price),0) as price from ( " +
            "select count(*) as counts,sum(je) as price from reserve (nolock) where SDDZ =#{deviceId}  and DateDiff(dd,CZRQ,getdate())=0 and cs=0" +
            "group by zfserialnumber)t ")
    Map<String, String> getCensus(@Param("deviceId") String deviceId);


    @Select("select top(10) ISNULL(kehu,'游客') as user_name ,je as amount,czrq as create_time from reserve (nolock) where SDDZ =#{deviceId} " +
            "and DateDiff(dd,CZRQ,getdate())=0 and cs=0 order by czrq desc")
    List<AliOrderDTO> getAliOrderDTO(@Param("deviceId") String deviceId);

}
